package com.framwork.core.api.addressbook.dept.input;

import com.framwork.core.base.AbstractAPIInput;
import com.framwork.core.base.em.RequestMappering;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * @author ：james.liu
 * @date ：Created in 2022/3/8 15:42
 * @description：获取父部门信息
 * @version: 1.0
 */
public class OpenApisContactV3DepartmentsParentInput extends AbstractAPIInput {

    private String departmentId;


    public String getDepartmentId() {
        return departmentId;
    }

    public void setDepartmentId(String departmentId) {
        this.departmentId = departmentId;
    }

    public final String toBody(OpenApisContactV3DepartmentsParentInput input) {
//        if (Objects.isNull(input)) {
//            return null;
//        }
//        JSONObject r = new JSONObject();
//        if (StringUtils.isNotBlank(input.getDepartmentIdType())) {
//            r.put("department_id_type", input.getDepartmentIdType());
//        }
//        if (StringUtils.isNotBlank(input.getDepartmentId())) {
//            r.put("department_id", input.getDepartmentId());
//        }
//        if (StringUtils.isNotBlank(input.getUserIdType())) {
//            r.put("user_id_type", input.getUserIdType());
//        }
//        if (Objects.nonNull(input.getPageSize())) {
//            r.put("page_size", String.valueOf(input.getPageSize()));
//        }
//        if (StringUtils.isNotBlank(input.getPageToken())) {
//            r.put("page_token", input.getPageToken());
//        }
//        return r.toJSONString();
        return null;
    }

    /**
     * 定义路径
     */
    public final void eventCmd() {
        String format = RequestMappering.open_apis_contact_v3_departments_parent.getMapperName();
        if (StringUtils.isNotBlank(this.getUserIdType())) {
            format = format + "?user_id_type=" + this.getUserIdType();
        }
        if (StringUtils.isNotBlank(this.getDepartmentIdType())) {
            format = format + "&department_id_type=" + this.getDepartmentIdType();
        }
        if (Objects.nonNull(this.getPageSize())) {
            format = format + "&page_size=" + this.getPageSize();
        }
        if (StringUtils.isNotBlank(this.getPageToken())) {
            format = format + "&page_token=" + this.getPageToken();
        }
        this.setCmdId(format);
    }
}
